package com.educate.service.impl;

import com.educate.dao.StudentDao;
import com.educate.pojo.Student;
import com.educate.service.StudentService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author ：xqf
 * @date ：Created in 2021/12/21 21:25
 * @description：
 */
@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentDao studentDao;
    @Override
    public List<Student> queryAll() {

        return studentDao.queryAll();
    }

    @Override
    public boolean updatePhoneNumber(String username, String phone) {
        if(studentDao.updateStudent(username, phone)==1){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean deleteStudentByUsernameAndClassName(String username,String className) {
        //先根据className,username把stu_course表中的数据删了
        if(studentDao.deleteByClassNameAndUsername(className,username)==1){
            return true;
        }else {
            return false;
        }
    }

}
